<template>
  <el-drawer
    direction="ltr"
    custom-class="myDrawer"
    v-model="showDrawer"
    :show-close="false"
    :with-header="false"
    size="280px"
  >
    <ul ref="list">
      <div class="title">
        <img src="../../assets/logo.png" alt="" />
        <span>HotelAdmin</span>
      </div>
      <router-link to="/home/show">
        <i class="iconfont icon-diannao"></i><span>工作台</span>
      </router-link>
      <router-link to="/home/roomList"
        ><i class="iconfont icon-caidan"></i><span>房间列表</span></router-link
      >
      <router-link to="/home/roomAdd"
        ><i class="iconfont icon-fangjian"></i><span>房间上线</span></router-link
      >
      <router-link to="/home/dinnerList"
        ><i class="iconfont icon-shijian"></i><span>餐品列表</span></router-link
      >
      <router-link to="/home/dinnerAdd"
        ><i class="iconfont icon-qucan"></i><span>餐品上新</span></router-link
      >
      <router-link to="/home/order"
        ><i class="iconfont icon-dingdandingdanchaxun"></i><span>订单管理</span></router-link
      >
      <router-link to="/home/comment"
        ><i class="iconfont icon-xiaoxi"></i><span>评论管理</span></router-link
      >
      <router-link to="/home/user"
        ><i class="iconfont icon-yonghuguanli_huaban"></i><span>用户列表</span></router-link
      >
    </ul>
  </el-drawer>
</template>

<script lang="ts" setup>
import 'animate.css'
import { ref } from 'vue'
import { useStatus } from '../../store/status'
import { storeToRefs } from 'pinia'
const statuStore = useStatus()
const { showDrawer } = storeToRefs(statuStore)
const visiable = ref(false)
let list = ref()
const show = () => {
  visiable.value = !visiable.value
}
window.addEventListener('resize', function () {
  statuStore.showDrawer = false
})
</script>

<style lang="less" scoped>
.fade-enter-from,
.fade-leave-to {
  height: 0 !important;
}

.fade-enter-active,
.fade-leave-active {
  transition: all 0.5s;
}

.fade-enter-to,
.fade-leave-from {
  height: 159px !important;
}

.myDrawer {
  padding: 20px;
  font-size: 18px;
  color: var(--color);
  user-select: none;

  ul {
    display: flex;
    flex-direction: column;

    .title {
      width: 100%;
      height: 60px;
      display: flex;
      align-items: center;

      span {
        font-size: 18px;
        font-weight: bold;
        color: var(--color);
      }

      img {
        width: 60px;
        height: 60px;
      }
    }

    .visiable {
      overflow: hidden;
      height: 159px;
      transition: all 0.3s;

      a {
        padding: 0 30px;
      }
    }

    a {
      display: block;
      display: flex;
      align-items: center;
      height: 45px;
      text-decoration: none;
      color: var(--color);
      margin: 6px 0;
      border-radius: 5px;
      padding: 0 10px;

      &:active {
        background-color: rgba(0, 0, 0, 0.1);
      }

      span {
        margin-left: 10px;
      }
    }
  }
}

:global(.el-drawer) {
  background-color: var(--ElementFill) !important;
}
</style>
